//
//  huaiheCHooseTimeView.m
//  huaihe
//
//  Created by 暗流澎涌 on 2024/3/8.
//

#import "huaiheCHooseTimeView.h"
#import "HorizontalPickerView.h"
#import "huaiheManger.h"
@implementation huaiheCHooseTimeView

- (void)awakeFromNib{
    [super awakeFromNib];
    self.startBut.layer.cornerRadius = 22;
    self.times = [huaiheManger obtainmuicLong];
    NSMutableArray *array = [NSMutableArray new];
    for (int i=5; i<=175; ) {
        i = i + 5 ;
        [array addObject:[NSString stringWithFormat:@"%d", i]];
        
    }
     CGFloat width = 40;
     CGFloat height = 100;
//     HorizontalPickerView *  horizontalPickerView = [[HorizontalPickerView alloc] initWithFrame:CGRectMake(offset, offset, CGRectGetWidth(self.view.frame)-2*offset, offset) minimumLineSpacing:20];
//    HorizontalPickerView *  horizontalPickerView = [[HorizontalPickerView alloc] initWithFrame:CGRectMake(([UIScreen mainScreen].bounds.size.width - width)/2 -28, (234 -height)/2 , width, height) minimumLineSpacing:30];
    HorizontalPickerView *  horizontalPickerView = [[HorizontalPickerView alloc] initWithFrame:CGRectMake(width/2, 0 , ([UIScreen mainScreen].bounds.size.width - width ), height) minimumLineSpacing:30];
    [horizontalPickerView setBackgroundColor:[UIColor whiteColor]];
    [horizontalPickerView setResource:array];
    __weak __typeof(self)weakSelf = self;
     horizontalPickerView.horizontalPickerViewSelect = ^(NSString *object) {
         NSLog(@"object = %@", object);
         NSLog(@"object.intValue = %d", object.intValue);
//         weakSelf.times = object.intValue;
//         [weakSelf setOpenbutTyoe:NO];
         self.times = object.intValue*60;
     };
     [self.bgview addSubview:horizontalPickerView];
    
}


- (IBAction)clickDeleteV:(id)sender {
    [self removeFromSuperview];
    
}




- (IBAction)clickStart:(id)sender {
    
    [self removeFromSuperview];
    [huaiheManger setmuicLong:self.times];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"startContinu" object:nil];
}


@end
